#ifndef SNAKE_H
#define SNAKE_H

#include <QMainWindow>
#include<qpainter.h>
#include<QVector>
#include<qstring.h>
QT_BEGIN_NAMESPACE
namespace Ui { class snake; }
QT_END_NAMESPACE

class snake : public QMainWindow
{
    Q_OBJECT

public:
    explicit snake(QWidget* parent = 0);
    ~snake();
    void paintEvent(QPaintEvent* event);
    void InitSnake();
    QRect CreateRect();
    void IsEat();
    void IsHit();

private slots:
    void Snake_update();
private:
    Ui::snake* ui;
    QVector<QRect> vSnakeRect;
    QRect SnakeHead;
    void keyPressEvent(QKeyEvent* key);
    QTimer* timer;
    bool blsRun;
    bool blsOver;//是否结束
    QString sDisplay;//开始结束提示
    int nDirection;
    QRect food;//食物
    int nScore;//得分
    QString scoreLabel;//显示得分两个字
    int speed;
};
#endif // SNAKE_H
